define(
    ["PDUtilDir/grid", "PDUtilDir/searchBlock", "PDUtilDir/slidebar"],
    function (Grid, SearchBlock, Slidebar) {

        function init(cache, searchObj, detailObj) {
            SearchBlock.init('searchBlockId');
            // 初始化
            return Grid({
                id: "GuideGroupGirdDivId",
                pageSize: 10,
                index: true,
                multi: true,
                pagination: true,
                cache: false,
                layout: [
                    {
                        name: "团名称",
                        field: "travelGroupName",
                        width: '260px',
                        sort: true
                    },
                    {
                        name: "导游姓名",
                        field: "guideName",
                        sort: true
                    },
                    {
                        name: "导游电话",
                        field: "guidePhone"
                    },
                    {
                        name: "支付金额",
                        field: "payMoney",
                        sort: true
                    },
                    {
                        name: "导游费用",
                        field: "guideCost",
                        sort: true
                    },
                    {
                        name: "支付状态",
                        field: "status",
                        format: function (e) {
                            return cache.statusMap.get(e.row.status);
                        }
                    },
                    {
                        name: "操作",
                        field: "createTime",
                        sort: false,
                        format: function (e) {
                            var row = e.row, roleCode = row.roleCode, str = '';
                            //str = '<a href="javascript:angular.element(\'#GuideGroupGirdDivId\').scope().paySupport.run(\''
                            //		+ e.row.id + '\')">支付</a>';
                            //str += '<a href="javascript:angular.element(\'#GuideGroupGirdDivId\').scope().cancelSupport.run(\''
                            //    + e.row.travelGroupId + '\')">取消指派</a>';
                            if (roleCode == 1)
                                str += '<a href="javascript:angular.element(\'#GuideGroupGirdDivId\').scope().cancelSupport.run(\''
                                    + e.row.travelGroupId + '\')">取消指派</a>';
                            else if (roleCode == 2)
                                str += '<a href="javascript:angular.element(\'#GuideGroupGirdDivId\').scope().paySupport.run(\''
                                    + e.row.id + '\')">支付</a>';
                            else{
                                str += '<a href="javascript:angular.element(\'#GuideGroupGirdDivId\').scope().detailSupport.run(\'' + e.row.travelGroupId + '\',\'' + e.row.travelGroupName + '\')">查看报帐</a>';
                                str += '<a href="javascript:angular.element(\'#GuideGroupGirdDivId\').scope().uploadSupport.run(\'' + e.row.travelGroupId + '\',\'' + e.row.travelGroupName + '\')">上传报帐单</a>';
                            }
                            return str;
                        }
                    }],
                toolbar: [{
                    name: "查询",
                    icon: "fa fa-search",
                    callback: function (event) {
                        searchObj.run();
                    }
                }],
                data: {
                    type: 'URL',
                    value: getServer()
                    + '/flea/hclv/guide/guideTravelGroupPayInfo.htmls'
                }
            });
        }

        return {
            init: init
        }
    });
